package ae.pcfc.cldos.online.common.clddb.domain.manager.provider;

import java.util.List;

import ae.pcfc.cldos.online.common.clddb.dao.TempFileStorageDAO;
import ae.pcfc.cldos.online.common.clddb.domain.TempFileStorage;
import ae.pcfc.cldos.online.common.clddb.domain.manager.TempFileStorageDOM;

/**
 * Temp file storage dom implementationn
 * 
 * @author arosa
 *
 */
public class TempFileStorageDOMImpl implements TempFileStorageDOM {
	
	private TempFileStorageDAO tempFileStorageDAO;
	
	public void setTempFileStorageDAO(TempFileStorageDAO tempFileStorageDAO) {
		this.tempFileStorageDAO = tempFileStorageDAO;
	}

	public Long add(TempFileStorage tempFileStorage) {
		return tempFileStorageDAO.add(tempFileStorage);
	}
	
	public void remove(TempFileStorage tempFileStorage) {
		tempFileStorageDAO.remove(tempFileStorage);
	}

	public TempFileStorage findById(Long id) {
		return tempFileStorageDAO.getById(id);
		
	}

	public void markTransferedById(Long id) {
		TempFileStorage tempFileStorage = tempFileStorageDAO.getById(id);
		if(tempFileStorage!=null){
			tempFileStorage.setTransfered(true);
			tempFileStorageDAO.update(tempFileStorage);
		}
	}

	public void deleteTransferedFiles() {
		tempFileStorageDAO.deleteTransferedFiles();
		
	}
	
	public List<TempFileStorage> getPaymentVouchers(Long appId){
		return tempFileStorageDAO.getPaymentVouchers(appId);
	}
	
	public void deleteFileRecordsByIds(List<Long> ids){
		tempFileStorageDAO.deleteFileRecordsByIds(ids);
	}
	
	
}
